package com.example.demo.niuke.huawei_b;

import java.util.Arrays;
import java.util.Scanner;

/**
 * ******************************************************
 *
 * @author liugh9
 * @version 1.0
 * @classname Main3
 * @description
 * @date 2023/09/02 16:07
 * <p>
 * ******************************************************
 */
public class Main3 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        int n = s.length();
        int[] dp = new int[n];
        Arrays.fill(dp, -1);
        int end = 0;
        int len = -1;
        for (int i = 2; i < n; i++) {
            if (s.charAt(i) == '0') {
                if (!isvail(s, i - 2, i - 1)) {
                    continue;
                }
                if (dp[i - 2] > 0) {
                    dp[i] = dp[i - 2] + 2;
                } else {
                    dp[i] = 3;
                }
                if (len < dp[i]) {
                    len = dp[i];
                    end = i;
                }
            }
        }
        System.out.println(len == -1 ? -1 : s.substring(end - len + 1, end + 1));
    }

    private static boolean isvail(String s, int i, int j) {
        return s.charAt(i) == '0' && s.charAt(j) == '1';
    }
}
